import SwiftUI

/*
 * 多页夹示例
 */
class TabViewExample: FCUIView{
    /*
     * 初始化布局
     */
    override func onLoad(){
        let isInit = super.m_isInit
        super.onLoad()
        if !isInit{
            m_paint.defaultUIStyle = "light"
            let width = Double(self.frame.size.width), height = Double(self.frame.size.height)
            renderFaceCat(name:"tabviewexample", paint: m_paint, size: FCSize(cx:width, cy:height))
            let tabPage = findViewByName(name:"TabPage2", views:m_paint.views)
            let tabView2 = FCTabView()
            tabView2.location = FCPoint(x:50, y:50)
            tabView2.size = FCSize(cx:400, cy:300)
            addViewToParent(view:tabView2, parent:tabPage)
            for i in 0...4{
                let newTabPage = FCTabPage()
                let tabButton = FCButton()
                tabButton.size = FCSize(cx:100, cy:20)
                tabButton.viewType = "tabbutton"
                tabButton.text = "选项" + String(i)
                addTabPage(tabView:tabView2, tabPage:newTabPage, tabButton:tabButton)
            }
            updateTabLayout(tabView:tabView2)
        }
    }
}
